//
// Created by HP on 2024/2/28.
//

#include "COMM_thread.h"
#include "AuroraCOMM.h"


char  __attribute__((section(".ccmram"))) comm_thread_stack[COMM_THREAD_STACK_SIZE];
struct rt_thread __attribute__((section(".ccmram"))) comm_thread;

void COMM_thread(void *param){

    AuroraCOMM comm;
    while(true){
        //USB 数据接收
        if(usbcdc_recvlen > 0){
            comm.recvMsg(usbcdc_recvbuff,usbcdc_recvlen);
            usbcdc_recvlen = 0;
        }

        if( foc2comm_msg.cmd != IS_NONE){
            foc2comm_msg.cmd = IS_NONE;
            comm.dealmsgEvent_from_FOC(&foc2comm_msg);
        }

        rt_thread_mdelay(3);
    }
}


